package com.jucai.pppeiyouclient.adapter;

import android.content.Context;

import com.jucai.pppeiyouclient.R;
import com.jucai.pppeiyouclient.base.CommonRecyclerViewAdapter;
import com.jucai.pppeiyouclient.bean.ActivityBean;

import java.util.List;

/**
 * Created by Kuky on 2017-04-22.
 */

public class RunningActivityAdapter extends CommonRecyclerViewAdapter<ActivityBean> {

    public RunningActivityAdapter(Context context, List<ActivityBean> data) {
        super(context, data);
    }

    @Override
    public void bindHolder(CommonHolder holder, ActivityBean activityBean) {
        holder.setText(R.id.activity_name, activityBean.getTactivity_title());
        holder.setText(R.id.activity_start, "开始时间：" + activityBean.getTactivity_start_time());
        holder.setText(R.id.activity_end, "结束时间：" + activityBean.getTactivity_end_time());

//        if (activityBean.getState() == 1) {
//            holder.setText(R.id.activity_state, "收取");
//        } else if (activityBean.getState() == 2) {
//            holder.setText(R.id.activity_state, "支付");
//        }
        String price = activityBean.getTactivity_price();

        if (price.startsWith("-")) {
            holder.setText(R.id.activity_fee, "支付  ¥" + price.split("-")[1] + "/人");
        } else {
            holder.setText(R.id.activity_fee, "收取  ¥" + price + "/人");
        }
        holder.setText(R.id.activity_line, "路线：" + activityBean.getTactivity_start_address() + "-" +
                activityBean.getTactivity_end_address());
        holder.setText(R.id.activity_count, "最大参与人数：" + activityBean.getTactivity_max_people() + "人" +
                "   报名人数：" + activityBean.getTactivity_signup_num() + "人");
    }

    @Override
    protected int getItemType(int position) {
        return 0;
    }

    @Override
    public int getLayoutId(int viewType) {
        return R.layout.item_activity_layout;
    }
}
